Optimal. Leaf size=70 \[ \frac{2 a b x}{\left (a^2+b^2\right )^2}-\frac{b \sin (x)}{\left (a^2+b^2\right ) (a \cos (x)+b \sin (x))}-\frac{\left (a^2-b^2\right ) \log (a \cos (x)+b \sin (x))}{\left (a^2+b^2\right )^2} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.166461, antiderivative size = 87, normalized size of antiderivative = 1.24, number of steps used = 6, number of rules used = 5, integrand size = 16, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.312, Rules used = {3111, 3098, 3133, 3097, 3075} \[ \frac{2 a b x}{\left (a^2+b^2\right )^2}-\frac{b \sin (x)}{\left (a^2+b^2\right ) (a \cos (x)+b \sin (x))}-\frac{a^2 \log (a \cos (x)+b \sin (x))}{\left (a^2+b^2\right )^2}+\frac{b^2 \log (a \cos (x)+b \sin (x))}{\left (a^2+b^2\right )^2} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3111
Rule 3098
Rule 3133
Rule 3097
Rule 3075
Rubi steps
\begin{align*} \int \frac{\cos (x) \sin (x)}{(a \cos (x)+b \sin (x))^2} \, dx &=\frac{a \int \frac{\sin (x)}{a \cos (x)+b \sin (x)} \, dx}{a^2+b^2}+\frac{b \int \frac{\cos (x)}{a \cos (x)+b \sin (x)} \, dx}{a^2+b^2}-\frac{(a b) \int \frac{1}{(a \cos (x)+b \sin (x))^2} \, dx}{a^2+b^2}\\ &=\frac{2 a b x}{\left (a^2+b^2\right )^2}-\frac{b \sin (x)}{\left (a^2+b^2\right ) (a \cos (x)+b \sin (x))}-\frac{a^2 \int \frac{b \cos (x)-a \sin (x)}{a \cos (x)+b \sin (x)} \, dx}{\left (a^2+b^2\right )^2}+\frac{b^2 \int \frac{b \cos (x)-a \sin (x)}{a \cos (x)+b \sin (x)} \, dx}{\left (a^2+b^2\right )^2}\\ &=\frac{2 a b x}{\left (a^2+b^2\right )^2}-\frac{a^2 \log (a \cos (x)+b \sin (x))}{\left (a^2+b^2\right )^2}+\frac{b^2 \log (a \cos (x)+b \sin (x))}{\left (a^2+b^2\right )^2}-\frac{b \sin (x)}{\left (a^2+b^2\right ) (a \cos (x)+b \sin (x))}\\ \end{align*}
Mathematica [C] time = 0.239182, size = 144, normalized size = 2.06 \[ \frac{a \cos (x) \left (\left (b^2-a^2\right ) \log \left ((a \cos (x)+b \sin (x))^2\right )-2 i x (a+i b)^2\right )+b \sin (x) \left (\left (b^2-a^2\right ) \log \left ((a \cos (x)+b \sin (x))^2\right )+2 (a+i b) (a (-1-i x)+b (x+i))\right )+2 i \left (a^2-b^2\right ) \tan ^{-1}(\tan (x)) (a \cos (x)+b \sin (x))}{2 \left (a^2+b^2\right )^2 (a \cos (x)+b \sin (x))} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A] time = 0.089, size = 120, normalized size = 1.7 \begin{align*}{\frac{a}{ \left ({a}^{2}+{b}^{2} \right ) \left ( a+b\tan \left ( x \right ) \right ) }}-{\frac{\ln \left ( a+b\tan \left ( x \right ) \right ){a}^{2}}{ \left ({a}^{2}+{b}^{2} \right ) ^{2}}}+{\frac{\ln \left ( a+b\tan \left ( x \right ) \right ){b}^{2}}{ \left ({a}^{2}+{b}^{2} \right ) ^{2}}}+{\frac{\ln \left ( \left ( \tan \left ( x \right ) \right ) ^{2}+1 \right ){a}^{2}}{2\, \left ({a}^{2}+{b}^{2} \right ) ^{2}}}-{\frac{\ln \left ( \left ( \tan \left ( x \right ) \right ) ^{2}+1 \right ){b}^{2}}{2\, \left ({a}^{2}+{b}^{2} \right ) ^{2}}}+2\,{\frac{ab\arctan \left ( \tan \left ( x \right ) \right ) }{ \left ({a}^{2}+{b}^{2} \right ) ^{2}}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A] time = 1.71112, size = 159, normalized size = 2.27 \begin{align*} \frac{2 \, a b x}{a^{4} + 2 \, a^{2} b^{2} + b^{4}} - \frac{{\left (a^{2} - b^{2}\right )} \log \left (b \tan \left (x\right ) + a\right )}{a^{4} + 2 \, a^{2} b^{2} + b^{4}} + \frac{{\left (a^{2} - b^{2}\right )} \log \left (\tan \left (x\right )^{2} + 1\right )}{2 \,{\left (a^{4} + 2 \, a^{2} b^{2} + b^{4}\right )}} + \frac{a}{a^{3} + a b^{2} +{\left (a^{2} b + b^{3}\right )} \tan \left (x\right )} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 0.506245, size = 323, normalized size = 4.61 \begin{align*} \frac{2 \,{\left (2 \, a^{2} b x + a b^{2}\right )} \cos \left (x\right ) -{\left ({\left (a^{3} - a b^{2}\right )} \cos \left (x\right ) +{\left (a^{2} b - b^{3}\right )} \sin \left (x\right )\right )} \log \left (2 \, a b \cos \left (x\right ) \sin \left (x\right ) +{\left (a^{2} - b^{2}\right )} \cos \left (x\right )^{2} + b^{2}\right ) + 2 \,{\left (2 \, a b^{2} x - a^{2} b\right )} \sin \left (x\right )}{2 \,{\left ({\left (a^{5} + 2 \, a^{3} b^{2} + a b^{4}\right )} \cos \left (x\right ) +{\left (a^{4} b + 2 \, a^{2} b^{3} + b^{5}\right )} \sin \left (x\right )\right )}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-2)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: AttributeError} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] time = 1.09075, size = 194, normalized size = 2.77 \begin{align*} \frac{2 \, a b x}{a^{4} + 2 \, a^{2} b^{2} + b^{4}} + \frac{{\left (a^{2} - b^{2}\right )} \log \left (\tan \left (x\right )^{2} + 1\right )}{2 \,{\left (a^{4} + 2 \, a^{2} b^{2} + b^{4}\right )}} - \frac{{\left (a^{2} b - b^{3}\right )} \log \left ({\left | b \tan \left (x\right ) + a \right |}\right )}{a^{4} b + 2 \, a^{2} b^{3} + b^{5}} + \frac{a^{2} b \tan \left (x\right ) - b^{3} \tan \left (x\right ) + 2 \, a^{3}}{{\left (a^{4} + 2 \, a^{2} b^{2} + b^{4}\right )}{\left (b \tan \left (x\right ) + a\right )}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]